package org.ezplatform.office.questionnaire.dao;
 
import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.questionnaire.entity.QuestionnaireSetItems;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository("questionnaireSetItemsDao")
public interface QuestionnaireSetItemsDao extends JpaBaseDao<QuestionnaireSetItems,String>{
	
	@Modifying
	@Query(nativeQuery = true, value = "delete from oa_questionnaire_set_items where topic_id in (?1)")
	int deleteItemsByTopicId(List<String> list);
	
	@Query("from QuestionnaireSetItems where topicId = ?1 order by sortNo")
	List<QuestionnaireSetItems> getItemsByTopicId(String topicId);
	
	@Query("from QuestionnaireSetItems where topicId in (select t.id from QuestionnaireSetTopic t where t.setId =?1)")
	List<QuestionnaireSetItems> getItemsBySetId(String setId);
	
}